package org.fund.common.constant;

/**
 * @Author Moro
 * @Date 2022/3/7 22:14
 * @title FundEnum
 */
public enum FundEnum {
    ALL(0,"全部"),
    ZHI_SHU(1,"指数型"),
    GU_PIAO(2,"股票型"),
    HUN_HE(3,"混合型"),
    ZHAI_QUAN(4,"债券型");

    private  final int code;
    private final String description;

    FundEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }
    public static String getCode(FundEnum fundEnum){
        switch (fundEnum){
            case ALL:
                return "all";
            case HUN_HE:
                return "hh";
            case GU_PIAO:
                return "gp";
            case ZHI_SHU:
                return "zs";
            case ZHAI_QUAN:
                return "zq";
        }
        return null;
    }

    public static FundEnum getInstance(int code){
        for (FundEnum value : FundEnum.values()) {
            if (code == value.getCode()){
                return value;
            }
        }
        return null;
    }
    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
